package com.xbao.opensearch.controller;

import com.xbao.core.component.page.Pagination;
import com.xbao.core.http.CommRequest;
import com.xbao.model.open.OpenContentReq;
import com.xbao.model.open.OpenContentVo;
import com.xbao.model.req.SubjectReq;
import com.xbao.open.OpenService;
import com.xbao.service.SubjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Api(value = "/opencontent", tags = "opencontent")
@RequestMapping(value = "opencontent")
@Controller
@EnableAutoConfiguration
public class OpenSearchController extends BaseController {
    @Resource
    private OpenService openService;

    @ApiOperation(value = "search", notes = "search")
    @RequestMapping(value = "/search",method = RequestMethod.POST)
    @ResponseBody
    public Object search(@RequestBody CommRequest<OpenContentReq> openContentReqCommRequest) {
        Pagination<OpenContentVo> vos= openService.searchContents(openContentReqCommRequest.getData());
        return result();
    }
}
